home *** CD-ROM | disk | FTP | other *** search
- /************************************************************************/
- /* Purpose..:Window Definition Procedure Skeleton */
- /************************************************************************/
-
- #include <Types.h>
- #include "A4Stuff.h" // also included in <MacHeaders>
- #include "SetupA4.h" // required to handle callback functions
- #include <Controls.h>
- #include <Windows.h>
-
- static short scrollval;
-
- /****************************************************************/
- /* Purpose..: Scrollbars action proc */
- /* Input....: see below */
- /* Returns..: --- */
- /****************************************************************/
- static pascal void actionProc(ControlHandle ch, short part)
- {
- //
- // here A4 may no longer point to our data segment
- //
- long oldA4=SetUpA4(); // set A4 to point to "remembered" global data segment
- // pointer before(!) using any global data or strings
- //
- // now we can use global data as long as we stay within this code resource
- //
-
- switch (part)
- {
- case inUpButton: SetCtlValue(ch, GetCtlValue(ch) - scrollval); break;
- case inDownButton: SetCtlValue(ch, GetCtlValue(ch) + scrollval); break;
- case inPageUp: SetCtlValue(ch, GetCtlValue(ch) - 100); break;
- case inPageDown: SetCtlValue(ch, GetCtlValue(ch) + 100); break;
- }
-
- RestoreA4(oldA4); // restore A4 to saved value before returning
- }
-
- static short use_callback(ControlHandle theControl,Point pt)
- {
- //
- // this function shows how to use callback functions within a code resources:
- //
- RememberA4(); // before using any callback function we have to remember
- // our current A4 data segment pointer. Note: RememberA4 only
- // works for the current source file (see <SetupA4.h>)
- scrollval=10;
-
- return TrackControl(theControl,pt,actionProc);
- }
-
- /************************************************************************/
- /* Purpose..: Window Definition Procedure Entry */
- /* Important: main() must always be in the first segment */
- /* Input....: variation code */
- /* Input....: pointer to window structure */
- /* Input....: dispatch message */
- /* Input....: a universal parameter */
- /* Return...: Depends on message */
- /************************************************************************/
- pascal long main(short varCode,WindowPeek theWindow,short theMessage,long param)
- {
- //
- // here A4 does not point to our data segment, so we cannot use any global data.
- //
- long oldA4; // used to store old A4 value
- long ret=0;
-
- oldA4=SetCurrentA4(); // setup A4 to point to global data segment
- // before(!) using any global data or strings
- //
- // now we can use global data as long as we stay within this code resource
- //
- switch(theMessage)
- {
- case wNew:
- break;
- case wDispose:
- break;
- case wDraw:
- break;
- case wHit:
- break;
- case wCalcRgns:
- break;
- case wGrow:
- break;
- case wDrawGIcon:
- break;
- }
-
- SetA4(oldA4); // restore A4 to saved value before returning
- return(ret);
- }
-